import socket 
import time          
h = '127.0.0.1' # Symbolic name meaning the local host

p = 80 # Arbitrary non-privileged port

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Pour TCP, pour UDP remplacer SOCK_STREAM par SOCK_DGRAM

s.bind((h, p))
print ('Serverlistening....')
s.listen(1)
conn, addr = s.accept()
print ('Connected by', addr)
var=0
while var==0:
        print ('jattend...')
        data = conn.recv(32)
        if data[-1]==37:
		        var=1
        print ('dernier car lu',repr(data[-1]))
        print ('Received', repr(data))
        
conn.send(bytes('coucou','UTF-8'))  

time.sleep(10)  
conn.close()


